package com.java2207.group1.listener;


import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.java2207.group1.bo.OccupancyBo;
import com.java2207.group1.pojo.Occupancy;
import com.java2207.group1.service.OccupancyService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 15319 2022/7/27 14:56
 */
@Component
@Scope("prototype")
public class WebOccupancyListener extends AnalysisEventListener<OccupancyBo> {
    private OccupancyService occupancyService;


    @Override
    public void invoke(OccupancyBo occupancyBo, AnalysisContext analysisContext) {
        Occupancy occupancy = new Occupancy();
        BeanUtils.copyProperties(occupancyBo,occupancy);
        occupancyService.occupancyAdd(occupancy);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
